<?php

namespace App\Admin\Eloquent;
/**
 * 项目投资记录
 */
class ProjectsUser extends Model
{
	//指定数据表
	protected $table = 'projects_user';
  protected $fillable = ['sn','projects_id', 'user_id','identity_id', 'user_name', 'invest_money', 'invest_time',
  'expected_return','born_trade_detail_id'];

  public $timestamps = false;

  public static function page_query(array $args,int $pagesize=15){
  	$query = ProjectsUser::where('projects_id','=',$args['projects_id']);

    if (isset($args['user_name']) && !empty($args['user_name'])){
      $query = $query->where('user_name', 'like', '%' . $args['user_name'] . '%');
    }

  	return $query->orderBy('invest_time', 'desc')->paginate($pagesize);
  }
}